<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>关注动态</title>
    <link rel="icon" href="/leek_bbs/statics/images/favicon.ico" >
    <link rel="stylesheet" href="/leek_bbs/statics/yu-ui/js_css/yu.css">
    <link rel="stylesheet" href="/leek_bbs/statics/layui/css/layui.css">
    <link rel="stylesheet" href="/leek_bbs/statics/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/leek_bbs/statics/css/main.css">
    <script src="/leek_bbs/statics/component/common_import.js"></script>
    <style>
        .row > ul > li{
            margin-left: 30px;
            padding: 18px 5px;
            width: 94%;
            border-bottom: 1px solid #e5e5e5;
        }
        .row > ul li a{
            color: #333;
        }
        .row > ul li a:hover h4{
            color: #ff6f3d;
        }
        .d-img{
            width: 25px !important;
            height: 25px !important;
            vertical-align: bottom;
        }
        .d-overflow{
            width: 80%;
            /*超过部分隐藏*/
            overflow: hidden;
            /*超过部分用...代替*/
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
        }
        .d-overflow img{
            width: 22px;
            height: 22px;
        }
        footer{
            margin-top: 50px;
        }
        .d-hidden{
            display: none;
        }
    </style>
</head>

<body>
<div class="container-fluid">
    <!-- 导航开始 -->
    <div id="hmc">
        <head_menu_comp :is_login="isLoginShow" ref="fo"></head_menu_comp>
    </div>
    <!-- 导航结束 -->
    <!-- 中间主体部分 -->
    <div class="container d-hidden" id="dynamicApp">
        <div class="row">
            <span style="opacity: .8;">
                <a href="/leek_bbs/skipPage/index"><span class="glyphicon glyphicon-home"></span></a>&nbsp;>&nbsp;
                <a href="javascript:;">动态</a>&nbsp;>&nbsp;
                <span>我的关注</span>
            </span>
            <!-- <span style="float: right;"><a href="javascript:;">我的收藏</a></span>-->
        </div>
        <div class="row" style="margin-top: 20px;width: 94%;background-color: #fff;" v-cloak="">
            <ul v-if="isExistData">
                <li v-for="item in carePosts" v-if="item.id != null">
                    <a :href="'/leek_bbs/skipPage/blogPage?theme_id='+item.id" :key="item.id">
                        <img :src="'/leek_bbs/'+item.picture" class="d-img img-circle" alt=""><span style="opacity: .7;">&emsp;{{item.post_author}}&emsp;&emsp;发布了新主题</span>
                        <h4 style="font-weight: bold;">{{item.title}}</h4>
                        <div class="d-overflow" style="opacity: .7;" v-html="item.content">
                        </div>
                    </a>
                </li>
            </ul>
            <div class="row" v-else ><h3 align="center" style="margin: 30px 5px;opacity: .7;">暂无动态内容</h3></div>
        </div>
    </div>
    <!-- 页脚部分 -->
    <footer id="footer" class="d-hidden">
        <div class="row">
            <p>
                <span>Copyright &nbsp;© 2020 &nbsp;凛冬</span>
                <span>版权所有&nbsp;All Rights Reserved.</span>
            </p>
        </div>
    </footer>
</div>
<script src="/leek_bbs/statics/component/head_menu.js"></script>
<script>
    const dynamicApp = new Vue({
        el:"#dynamicApp",
        data:{
            isExistData:true,
            carePosts:[]
        },
        methods:{
            getCarePostsData(){
                axios.get(`/leek_bbs/bbs/care/listCarePosts?uid=${userInfo.id}`).then(response => {
                    const data = response.data;
                    //console.log(data);
                    if (data[0] == null){
                        this.isExistData = false;
                    }
                    this.carePosts = data;
                }).catch(error => {
                    ui.error("获取数据出现异常",3000,true);
                    console.log(error);
                })
            }
        }
    });
    setTimeout(() => {
        if (userInfo != null){
            dynamicApp.getCarePostsData();
            $("#dynamicApp").removeClass("d-hidden");
            $("#footer").removeClass("d-hidden");
        } else {
            layui.login();
        }
    },200);
</script>
</body>
</html>